package top.eggcode.setup.event;

import org.ehcache.event.CacheEvent;
import org.ehcache.event.CacheEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Title:
 * Description: TODO
 * Date: 2021/6/1 23:26
 *
 * @author JiaQi Ding
 * @version 1.0
 */
public class CacheEventLogger implements CacheEventListener<Object, Object> {

    private static final Logger logger = LoggerFactory.getLogger(CacheEventLogger.class);

    // ...

    @Override
    public void onEvent(CacheEvent cacheEvent) {
        logger.info("Cache event = {}, Key = {},  Old value = {}, New value = {}", cacheEvent.getType(),
                cacheEvent.getKey(), cacheEvent.getOldValue(), cacheEvent.getNewValue());
    }
}
